package com.yootk.servlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@WebServlet("/JSTLServlet")
public class JSTLServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Map<String, Object> map = new HashMap<>(); // 定义Map集合
        map.put("flag", true); // 设置属性内容
        map.put("age", 18); // 设置属性内容
        map.put("muyan", "yootk.com"); // 设置属性内容
        req.setAttribute("result", map); // 将所需要的内容保存在request属性范围之中
        req.getRequestDispatcher("/2/test02.jsp").forward(req, resp); // 服务端跳转
    }
}
